<?php
function addbuttonslistproject($group, $id, $class_state, $group_project, $semester, $academic_year) {
	
	if($class_state == STATE_OPEN || $class_state == STATE_ONGOING){
		$button_class = "";
	} else {
		$button_class = "elgg-button-cancel";
	}
	
	if ($group->getOwnerGUID () == elgg_get_logged_in_user_guid ()) {
		$group_project_bt = "";
		$group_project_delete = "";
		$group_project_addproject = "";
		$group_project_close = "";
		$del_confirm = elgg_echo ( 'submana:delete' );
		$group_project_delete = elgg_view ( 'output/url', array (
				'id' => "bt_group_project_delete_$id",
				'text' => 'Xóa',
				'rel' => $del_confirm,
				'href' => elgg_add_action_tokens_to_url ( 'submana/deleteprojectlist/' . $group->guid . '/' . $group_project . "/" . $semester . "/" . $academic_year ),
				'class' => 'elgg-button elgg-button-delete elgg-requires-confirmation',
				'style' => "width:8%; float: right; margin-left: 5px;" 
		) );
		if ($class_state != STATE_CLOSE) {
			$group_project_close = elgg_view ( 'output/url', array (
					'id' => "bt_group_project_close_$id",
					'text' => 'Kết thúc',
					'href' => 'submana/closeclass/' . $group->guid . '/' . $group_project . "/" . $semester . "/" . $academic_year,
					'class' => 'elgg-button elgg-requires-confirmation',
					'rel' => "Xác nhận kết thúc lớp học?",
					'style' => "width:15%; float: right;margin-left: 5px;",
					'is_action' => true,
					'is_trusted' => true 
			) );
			
			$group_project_edit = elgg_view ( 'output/url', array (
					'id' => "bt_group_project_edit_$id",
					'text' => 'Sửa',
					'href' => '',
					'class' => 'elgg-button elgg-button-cancel',
					'style' => "width:8%; float: right;margin-left: 5px;" 
			) );
			
			$group_project_addproject = elgg_view ( 'output/url', array (
					'id' => "bt_group_project_add_$id",
					'text' => 'Thêm đề tài',
					'href' => 'submana/addlistpro/' . $group->guid . '/' . $group_project . "/" . $semester . "/" . $academic_year . "/" . "existed",
					'class' => 'elgg-button',
					'style' => "width:20%; float: right;margin-left: 5px;" 
			) );
			$group_project_bt = elgg_view ( 'input/button', array (
					'id' => "bt_group_project_$id",
					'onclick' => "toggle('group_project_$id')",
					'value' => 'Mã lớp: ' . "$group_project" . ", " . $semester . ", Năm học " . $academic_year,
					'style' => "width:50%; float:left;",
					'class' => $button_class 
			) );
		} else {
			$group_project_bt = elgg_view ( 'input/button', array (
					'id' => "bt_group_project_$id",
					'onclick' => "toggle('group_project_$id')",
					'value' => 'Mã lớp: ' . "$group_project" . ", " . $semester . ", Năm học " . $academic_year,
					'style' => "width:100%; float:left;",
					'class' => $button_class 
			) );
		}
		$content = "";
		$content .= "<div>$group_project_bt";
		
		$content .= "$group_project_close $group_project_delete $group_project_addproject</div>";
	} else {
		$group_project_bt = elgg_view ( 'input/button', array (
				'id' => "bt_group_project_$id",
				'onclick' => "toggle('group_project_$id')",
				'value' => 'Mã lớp: ' . "$group_project" . ", " . $semester . ", Năm học " . $academic_year,
				'style' => "width:100%; float:left;",
				'class' => $button_class 
		) );
		
		$content = "<div>$group_project_bt</div>";
	}
	return $content;
}